/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.sql.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.M020;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class M020Store extends M020 {

    public List<M020> mcurpks_listoftabm020(int pnFH000, int pnFH200,int pnPM020, int pnFV050,int pnFN100,String pvMV023, Date pdMD023F,Date pdMD024T,int pnMN026, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.mcurpks_listoftabm020, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                     new Param(OracleTypes.INTEGER, pnPM020),
                    new Param(OracleTypes.INTEGER, pnFV050),
                    new Param(OracleTypes.INTEGER, pnFN100),
                    new Param(OracleTypes.CHAR, pvMV023),
                    new Param(OracleTypes.DATE, pdMD023F),
                    new Param(OracleTypes.DATE, pdMD024T),
                    new Param(OracleTypes.INTEGER, pnMN026),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });

        return super.find(dataStatement, M020.class);
    }
    
    public List<M020> mcurpks_listoftabm020Re(String pvMV023, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.mcurpks_listoftabm020_tung, OracleTypes.CURSOR, new Param[]{

                    new Param(OracleTypes.CHAR, pvMV023),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });

        return super.find(dataStatement, M020.class);
    }

    public int stdm_tools_inserttabm020(int pnPM020, String pvMV021, String pvMV022,String pvMV023, Date pdMD023, Date pdMD024, String pvMV025,int pnMN026, int pnFM000, int pnFV050, int pnFN100,String pvMV030,String pvMV031, String pvLOGIN) {
        try {
//            -- MV021` varchar(256), -- chu dde ghi chu
//   -- MV022` text,  -- noi dung goi ddi
//   -- MD023` date,  -- ngay cap nhat sms
//   -- MD024` date,  -- ngay goi SMS
//   -- MV025` varchar(8), -- trang thai goi sms
//   -- FM010` int(11) NOT NULL,  -- template dda bo sung
//   -- FM000` int(11) NOT NULL,  -- template dda ddang kiem
//   -- FV050` int(11) NOT NULL,  -- tour
//   -- FN100` int(11) NOT NULL,  -- nguoi nhan
            DataStatement updateStatement = new DataStatement(PackageContants.stdm_tools_inserttabm020, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPM020),
                        new Param(OracleTypes.CHAR, pvMV021),//MV021` varchar(256), -- chu dde ghi chu
                        new Param(OracleTypes.CHAR, pvMV022),
                        new Param(OracleTypes.CHAR, pvMV023),
                        new Param(OracleTypes.DATE, pdMD023),//   -- MD023` date,  -- ngay cap nhat sms
                        new Param(OracleTypes.DATE, pdMD024),//   -- MD024` date,  -- ngay goi SMS
                        new Param(OracleTypes.CHAR, pvMV025),//   -- MV025` varchar(8), -- trang thai goi sms
                         new Param(OracleTypes.INTEGER, pnMN026),
                        new Param(OracleTypes.INTEGER, pnFM000),//   -- FM000` int(11) NOT NULL,  -- template dda ddang kiem
                        new Param(OracleTypes.INTEGER, pnFV050),//   -- FV050` int(11) NOT NULL,  -- to
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.CHAR, pvMV030),
                        new Param(OracleTypes.CHAR, pvMV031),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, M020.class);
        } catch (SQLException ex) {

            return 0;
        }

    }
    
     public int stdm_tools_stornotabm020(int pnPM020, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.stdm_tools_stornotabm020, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPM020),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, M020.class);
        } catch (SQLException ex) {
            Logger.getLogger(K330Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
}
